<div class = "ui modal small boxTopL">
    <i class = "close icon" ng-click="cancel()"></i>
    <div class = "header">
        添加字段计算
    </div>
    <div class="content pb5">
        <div class="ui small form">
            <div class="inline field">
                <label style="font-size:1em;">字段名称</label>
                <input type="text"  placeholder="请输入字段名称" ng-model="expressionTitle" id="exTitle">
            </div>
        </div>
       <!-- <label>字段名称</label>
        <input type="text" placeholder="字段" ng-model="expressionTitle" id="exTitle">-->
   <!-- </div>
    <div class="ui divider"></div>
    <div class="content">-->
        <!--字段-->
        <div class="sub header myFiled mt5" style="max-height: 120px;overflow: auto;magin: 4px;">
            字段：<button style="margin-top: 5px;" class="ui basic mini button" ng-repeat="item in table1.filed" ng-show="item.isShow" value="item.columnDesc" ng-click="addToCounter(item.columnDesc,item.fieldName)">{{ item.columnDesc }}</button>
        </div>

    </div>
    <!--运算表达-->
    <div class="content box" style="padding-top: 0;padding-bottom: 0;">
        <div class="filed" id="filedMySelected" style="overflow: auto;min-height: 30px;max-height: 300px;">

            <div class="gridly">
                <a ng-repeat="item in counterArry track by $index" title="{{item.desc}}" ng-click="btnActive($index)" id="{{$index}}" class="brick ui label" ng-class="{'curExpBtn':indexInArry[$index]!=-1}">
                    {{ item.desc }}
                    <i class="delete icon" ng-click="delCounArry($index,$event)"></i>
                </a>
            </div>
            <!--<a ng-repeat="item in counterArry track by $index" ng-click="btnActive($index)" class="ui label" ng-class="{'curExpBtn':indexInArry[$index]!=-1}">
                {{ item.desc }}
                <i class="delete icon" ng-click="delCounArry($index,$event)"></i>
            </a>-->
        </div>
        <div class="mt10 filed">
            表达式：
            <span ng-show="expressionTitle">{{expressionTitle}}=</span>
            <span ng-repeat="item in ArryForDesc track by $index">{{counterArry[ArryForDesc[$index]].desc}}</span>
        </div>
    </div>

    <!--Tab-->
    <div class="content" style="min-height: 140px;">
        <div class="ui top attached tabular menu">
            <a class="item active" data-tab="first">运算</a>
            <a class="item" data-tab="second">函数</a>
            <a class="item" data-tab="third">日期</a>
        </div>
        <!--运算 btn-->
        <div class="ui bottom attached tab segment active" data-tab="first" ng-init="numShow=false">
            <!--运算的符号-->
            <button class="ui button f20" ng-repeat="i in counter track by $index" ng-click="addToCounter(i,0)">{{i}}</button>
            <button class="ui button f20" ng-click="addToCounter('(','(')">(</button>
            <button class="ui button f20" ng-click="addToCounter(')',')')">)</button>
            <!--<button class="ui button f20" ng-click="numShowFun()" ng-show="!numShow">数字</button>-->
            <div class="mt10">
                <button class="ui button f20" ng-click="Addnumber(0)">0</button>
                <button class="ui button f20" ng-click="Addnumber(1)">1</button>
                <button class="ui button f20" ng-click="Addnumber(2)">2</button>
                <button class="ui button f20" ng-click="Addnumber(3)">3</button>
                <button class="ui button f20" ng-click="Addnumber(4)">4</button>

            </div>
            <div class="mt10">
                <button class="ui button f20" ng-click="Addnumber(5)">5</button>
                <button class="ui button f20" ng-click="Addnumber(6)">6</button>
                <button class="ui button f20" ng-click="Addnumber(7)">7</button>
                <button class="ui button f20" ng-click="Addnumber(8)">8</button>
                <button class="ui button f20" ng-click="Addnumber(9)">9</button>
            </div>



           <!-- <div class="ui small form mt20" ng-show="numShow">
                <div class="fields">
                    <div class="inline field">
                        <label>数字</label>
                        <input placeholder="请输入数字" type="text" ng-model="numT"/>
                    </div>
                    <div class="field">
                        <div class="ui mini button" ng-click="numShow=false">取消</div>
                        <div class="ui submit button red mini" ng-click="numOk()" ng-disabled="numT==null">确认</div>
                    </div>
                </div>
            </div>-->
        </div>

        <!--函数-->
        <div class="ui bottom attached tab segment" data-tab="second">
            <div ng-init = "cutFShow = false" ng-show="!cutFShow">
                <div>
                    字符转化：
                    <button class="ui mini button f20"  ng-click="funToCounter('转小写','LOWER')">转小写</button>
                    <button class="ui mini button f20"  ng-click="funToCounter('转大写','UPPER')">转大写</button>
                </div>
                <div class="mt5">
                    去除空格：
                    <button class="ui mini button f20"  ng-click="funToCounter('去头空格','LTRIM')">去头空格</button>
                    <button class="ui mini button f20"  ng-click="funToCounter('去尾空格','RTRIM')">去尾空格</button>
                </div>

                <div class="mt5">
                    截取字符：
                    <button class="ui mini button f20 jieQu" ng-click="cutFiled('从左截取','LEFT',1)">从左截取</button>
                    <button class="ui mini button f20 jieQu" ng-click="cutFiled('从右截取','RIGHT',2)">从右截取</button>
                    <button class="ui mini button f20 jieQu" ng-click="cutFiled('定位截取','SUBSTRING',3)">定位截取</button>
                    <button class="ui mini button f20 jieQu" ng-click="cutFiled('匹配截取','SUBSTRING_INDEX',4)">匹配截取</button>
                </div>
            </div>


          <!--  <div class="mt5 numBox"  ng-show="cutFShow" ng-init="substring=false;substring_index=false" >
                &lt;!&ndash;截取长度&ndash;&gt;
                <label ng-hide="substring||substring_index">截取长度：<input type="text" class="numInput" placeholder="请输入数字"ng-model="cutFiledInput"/></label>

                &lt;!&ndash;截取&ndash;&gt;
                <div ng-show="substring" class="fl mr10">
                    <label>起始位置：<input type="text" class="numInput" placeholder="请输入起始位置(数字)"ng-model="cutFiledInputStart"/></label>
                    <label>截取长度：<input type="text" class="numInput" placeholder="请输入截取长度(数字)"ng-model="cutFiledInputEnd"/></label>
                </div>
                <div ng-show="substring_index" class="mb10">
                    <label>匹配内容：<input type="text" class="numInput" placeholder="请输入要匹配的内容"ng-model="matchCut.matchMsg"/></label>
                    &lt;!&ndash;<div class="ui form mt5">&ndash;&gt;
                        <div class="fields">
                            <label>匹配方式：</label>
                            <div class=" inline field">
                                <div class="ui radio checkbox">
                                    <input type="radio" name="match" ng-checked="radioValue=='+'"  ng-model="radioValue" value="+">
                                    <label>正序 <i class="arrow down icon"></i></label>
                                </div>
                            </div>
                            <div class="inline  field">
                                <div class="ui radio checkbox">
                                    <input type="radio" name="match" ng-model="radioValue" value="-">
                                    <label>倒序 <i class="arrow up icon"></i></label>
                                </div>
                            </div>
                        </div>
                    &lt;!&ndash;</div>&ndash;&gt;

                    <label>匹配第次：<input type="text" class="numInput" placeholder="请输入匹配第几次" ng-model="matchCut.matchIndex"/></label>
                </div>

                <button class="ui button" ng-click="cutFiledCancel()">取消</button>
                <button class="button ui red" ng-click="cutFiledOk()">确认</button>
            </div>-->

<!--12122121212121-->
            <div class="ui small form" ng-show="cutFShow" ng-init="substring=false;substring_index=false">
                <div class="fields">
                    <!--普通截取-->
                    <div class="inline field" ng-hide="substring||substring_index">
                        <label>截取长度</label>
                        <input placeholder="请输入截取长度(数字)" type="text" ng-model="cutFiledInput"/>
                        <!--btn-->
                        <div class="inline field">
                            <div class="ui mini button" ng-click="cutFiledCancel()">取消</div>
                            <div class="ui submit button red mini" ng-click="cutFiledOk()">确认</div>
                        </div>
                    </div>
                    <!--定位截取-->
                    <div ng-show="substring">
                        <div class="inline field">
                            <label>起始位置</label>
                            <input placeholder="请输入起始位置(数字)" type="text" ng-model="cutFiledInputStart"/>
                        </div>
                        <div class="inline field">
                            <label>截取长度</label>
                            <input placeholder="请输入截取长度(数字)" type="text" ng-model="cutFiledInputEnd"/>
                        </div>
                        <!--btn-->
                        <div class="inline field">
                            <div class="ui mini button" ng-click="cutFiledCancel()">取消</div>
                            <div class="ui submit button red mini" ng-click="cutFiledOk()">确认</div>
                        </div>
                    </div>

                    <!--匹配截取-->
                    <div ng-show="substring_index" style="width:280px;" class="ui form">
                        <div class="field" style="margin-top: 10px;">
                            <label>匹配内容</label>
                            <input placeholder="请输入要匹配的内容" type="text" ng-model="matchCut.matchMsg"/>
                        </div>

                        <div class="field" style="margin-top: 10px;">
                            <label>匹配方式</label>
                            <div class="inline field">
                                <div class="radio-inline">
                                    <input class="cp" id="zRadio" type="radio" name="match" ng-checked="radioValue=='+'"  ng-model="radioValue" value="+">
                                    <label class="cp" for="zRadio">正序 <i class="arrow down icon"></i></label>
                                </div>                            
                                <div class="radio-inline">
                                    <input class="cp" id="fRadio" type="radio" name="match" ng-model="radioValue" value="-">
                                    <label class="cp" for="fRadio">倒序 <i class="arrow up icon"></i></label>
                                </div>
                            </div>
                        </div>

                        <div class="field" style="margin-top: 10px;">
                            <label>匹配第次</label>
                            <input placeholder="请输入匹配第几次" type="text" ng-model="matchCut.matchIndex"/>
                        </div>
                        <!--btn-->
                        <div class="field" style="margin-top: 10px;">
                            <div class="ui mini button" ng-click="cutFiledCancel()">取消</div>
                            <div class="ui submit button red mini" ng-click="cutFiledOk()">确认</div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!--日期-->
        <div class="ui bottom attached tab segment" data-tab="third">
            <div ng-init="newDatePanel=false" ng-show="!newDatePanel">
                <div class="mt5">
                    日期抽取：
                    <button class="ui small button f20" ng-repeat="item in dateData" ng-click="dateToCounter(item.text , item.exp)">{{ item.text }}</button>

                </div>
                <div class="mt5">
                    日期添加：<button class="ui small button f20" ng-click="newDateClick()">日期添加</button>
                </div>
            </div>

            <!--日期添加-->
            <div ng-show="newDatePanel" class="ui form" style="width:280px;">
                <h3>日期添加</h3>
               <!-- <div class="mt10">数值: <input class="numInput" type="text" ng-model="newDateValue.numValue"/></div>
                <div class="mt10">
                    数值类型:
                    <select name="newDate" ng-model="newDateValue.selectValue">
                        <option ng-repeat="item in newDateSelect" value="{{item.id}}">{{item.text}}</option>
                    </select>
                </div>
                <div class="actions mt10">
                    <button class="ui button mini" ng-click="newDateCancel()">取消</button>
                    <button class="ui button mini red" ng-click="newDateOk()">确认</button>
                </div>-->

                <div class="fileds">
                    <div class="filed" style="margin-top: 10px;">
                        <label>数值</label>
                        <input type="text" ng-model="newDateValue.numValue"/>
                    </div>
                    <div class="filed" style="margin-top: 10px;">
                        <label>数值类型</label>
                        <select name="newDate" ng-model="newDateValue.selectValue" ng-options="item.id as item.text for item in newDateSelect" ></select>
                    </div>
                    <div class="field" style="margin-top: 10px;">
                        <div class="ui mini button" ng-click="newDateCancel()">取消</div>
                        <div class="ui submit button red mini" ng-click="newDateOk()">确认</div>
                    </div>
                </div>
            </div>

            <div class="mt10">
                <label style="color: gray"><i class="warning sign icon"></i>注意：只用于时间字段</label>
            </div>
        </div>

    </div>
    <div class="content ui red" ng-show="msg">提示：{{msg}}</div>
    <div class = "actions">
        <button class = "ui button default" ng-click = "cancel()">取消</button>
        <button class = "ui button red" ng-click = "ok()">确定</button>
    </div>
</div>